// 禁止修改
import Vue from 'vue'
import App from '@/app.vue';
import routes from 'libs/router'
import store from 'libs/store'
import index from 'libs/index'
import props from 'libs/props'
import config from 'libs/config.json'
const key = config.type + '-' + config.name;
export function Bootstrap(params) { params.data.$vFN.Qk.bootstrap({ key,config }) }
export function Unmount(params) { params.data.$vFN.Qk.unmount({ key,config }) }
export function Mount(params) {
    __webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
    Vue.prototype.$vFN.Qk.beforeMount({ key,config, params });
    let _base = config.path?config.path:'/'+params.data.fromChannel+'/'+config.type+'/'+config.name;
    let router = new VueRouter({ mode: 'history', base: _base, routes });
    router.beforeEach((to, from, next) => {next(); });
    router.afterEach((to, from) => {});
    window.MicroAppConfiguration = { config:config, props:props,}
    let _id = '#' + key;
    index();
    window.instance[key].router = router;
    window.instance[key].app = new Vue({ router, store, render: h => h(App), }).$mount(params.data.container ? params.data.container.querySelector(_id) : _id);
    window.instance[key].config = { config, params,key,props };
    Vue.prototype.$vFN.Qk.mount({ key,config, params,key,props });
}

